<template>
	<div class="cont">
		<input type="text" v-model.lazy="value">
		<button @click="Ser">Search</button>
	</div>
</template>

<script>
// 引入axios
import axios from 'axios'

export default {
	name: 'SearchH',
	data() {
		return {
			value: '',
		}
	},
	methods: {
		Ser() {
			axios.get(`https://api.github.com/search/users?q=${this.value}`).then(
				response => {
					let date = response.data.items
					this.$bus.$emit('date',date)
				},
				error => {
					console.log('请求失败', error.message);
				}
			)
		}
	}
}
</script>

<style scoped>
.cont {
	width: 500px;
	height: 100px;
	padding: 50px;
	border-radius: 10px;
	margin: 0 auto;
	background-color: tomato;
}
</style>